package com.meilai.project.constant;

import lombok.Getter;

/**
 * @author 张驰
 * @date 2022/8/10 10:29
 */
@Getter
public enum AppUserTypeEnum {
    NORMAL(1, "普通"),
    WORKER(2, "工人"),
    MANAGER(3, "管理层");

    private Integer id;
    private String name;

    AppUserTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public static AppUserTypeEnum getEnumById(Integer id) {
        for (AppUserTypeEnum appUserTypeEnum : AppUserTypeEnum.values()) {
            if (appUserTypeEnum.getId().equals(id)) {
                return appUserTypeEnum;
            }
        }
        return null;
    }
}
